package demo.echarts.controller;

import demo.echarts.service.EChartsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * Echart操作接口
 */
@RestController
@RequestMapping("EchartsController")
@Slf4j
public class EchartsController {
    @Autowired
    private EChartsService eChartsService;

    /**
     * 根据模版导出word文档
     */
    @GetMapping("exportWord")
    public ResponseEntity<Resource> exportWord() throws IOException {
        log.info("开始导出word文档");

        //构建poi-tl数据模型
        return eChartsService.downloadWord("运行手册.docx");
    }



}
